package com.eliota.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.eliota.controller.dto.ProjectDto;
import com.eliota.entity.Project;
import com.eliota.mapper.ProjectMapper;
import com.eliota.service.ProjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author MG
 * @since 2023-04-01
 */
@Service
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements ProjectService {

    @Resource
    public ProjectMapper projectMapper;


    @Override
    public void statusChange(Integer projectId) {
        projectMapper.statusChange(projectId);
    }

    @Override
    public void deleteBatchByIds(List<Integer> ids) {
        for (Integer id : ids) {
            projectMapper.statusChange(id);
        }
    }

    @Override
    public void saveWithUser(Project project) {
        projectMapper.insert(project);

    }


    @Override
    public Page<Project> findPage(Page<Project> page, String projectName) {
        return projectMapper.findProjectPage(page,projectName);
    }


}
